﻿package mortal.game.view.skill.panel.render
{
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;

    public class SkillRuneItem extends GSprite
    {
        private var _nameBg:GBitmap;
        private var _txtName:GTextFiled;
        private var _iconBg:GImageBitmap;
        private var _txtNotGot:GTextFiled;
        private var _item:BaseItem;
        private var _myData:ItemData;

        public function SkillRuneItem()
        {
            return;
        }// end function

        public function set itemData(param1:ItemData) : void
        {
            this._myData = param1;
            this._txtNotGot.htmlText = Language.getString(21079);
            this._txtNotGot.x = 16;
            if (Cache.instance.role.entityInfo.level < 70)
            {
                this._txtNotGot.x = 7;
                this._txtNotGot.htmlText = Language.getString(21080);
            }
            if (this._myData == null)
            {
                this.mouseChildren = false;
                this.mouseEnabled = false;
                this._item.itemData = null;
                this._txtName.text = "";
                this.addChild(this._txtNotGot);
                return;
            }
            DisplayUtil.removeMe(this._txtNotGot);
            this._item.itemData = this._myData;
            this.mouseChildren = true;
            this.mouseEnabled = true;
            this._txtName.filters = [];
            this._txtName.htmlText = param1.itemInfo.htmlName;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._nameBg = UIFactory.gBitmap(ImagesConst.SkillRune_nameBg, -16, 0, this);
            var _loc_1:* = GlobalStyle.textFormatBai.center();
            _loc_1.color = 16777215;
            _loc_1.size = 13;
            this._txtName = UIFactory.gTextField("", -20, -2, 120, 20, this, _loc_1);
            this._txtName.mouseEnabled = false;
            this._iconBg = UIFactory.gImageBitmap(null, 2, 22, this);
            LoaderHelp.setBitmapdata(ImagesConst.SkillRuneBigBg + ".swf", this._iconBg);
            this._item = UIFactory.baseItem(9, this._iconBg.y + 7, 65, 65, this);
            this._item.isShowColorBg = false;
            this._item.mouseEnabled = true;
            this._item.mouseChildren = false;
            this._item.doubleClickEnabled = true;
            this._item.configEventListener(MouseEvent.DOUBLE_CLICK, this.clickMeHandler);
            _loc_1 = GlobalStyle.textFormatPutong;
            _loc_1.color = 8947848;
            _loc_1.size = 16;
            this._txtNotGot = UIFactory.gTextField("", 16, 50, 80, 60, this, _loc_1, true);
            this._txtNotGot.multiline = true;
            this._txtNotGot.wordWrap = true;
            this._txtNotGot.htmlText = Language.getString(21079);
            this._txtNotGot.mouseEnabled = false;
            if (Cache.instance.role.entityInfo.level < 70)
            {
                this._txtNotGot.x = 10;
                this._txtNotGot.htmlText = Language.getString(21080);
            }
            return;
        }// end function

        private function clickMeHandler(event:MouseEvent) : void
        {
            if (this._myData == null)
            {
                return;
            }
            GameProxy.role.dreesRune(null, this._myData.uid);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._nameBg.dispose(param1);
            this._nameBg = null;
            this._txtName.dispose(param1);
            this._txtName = null;
            this._iconBg.dispose(param1);
            this._iconBg = null;
            this._item.dispose(param1);
            this._item = null;
            if (this._txtNotGot != null)
            {
                this._txtNotGot.dispose(param1);
                this._txtNotGot = null;
            }
            return;
        }// end function

    }
}
